using System;
using System.Threading.Tasks;
using Avalonia.Controls;
using Avalonia.Interactivity;

namespace HelloDict.Desktop;

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
        //平台特异性：在Windows下使用应用内Menu，其他平台使用NativeMenu
        if (!OperatingSystem.IsWindows())
        {
            WindowsMenu.IsVisible = false;
        }
    }


    private void ExitMenu_OnClick(object? sender, EventArgs e)
    {
        Close();
    }

    private void ExitMenu_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
    {
        ExitMenu_OnClick(null, null);
    }

    private void SearchButton_OnClick(object? sender, RoutedEventArgs e)
    {
        var result = Core.QueryInter.Word(KeywordsBox.Text);
        DefinitionBlock.Text = result.Definition[0];
    }
}